﻿<UserControl ResxExtension.DefaultResxName="MuddyBoots.GreenlightQC.Mobile.UI.View.LoginView" Language="{UICulture}"
             x:Class="MuddyBoots.GreenlightQC.Mobile.UI.View.LoginView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:h="clr-namespace:MuddyBoots.GreenlightQC.Mobile.UI.Helpers"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:t="clr-namespace:MuddyBoots.GreenlightQC.Mobile.UI.View.Triggers"
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="900">

    <UserControl.Background>
        <ImageBrush ImageSource="/MuddyBoots.GreenlightQC.Mobile.UI;component/Assets/greenlight-background.jpg" />
    </UserControl.Background>

    <Grid>
        <Border BorderBrush="Black" BorderThickness="0.5" Background="White"  Height="200" Width="300" HorizontalAlignment="Left" VerticalAlignment="Top" CornerRadius="2" Margin="200,100,0,0">
            <StackPanel Orientation="Vertical">
                <Label Style="{StaticResource MainPageHeader}" Content="{Resx LogIn}" />
                <Border BorderBrush="Black" BorderThickness="0.1" Width="240" Height="120" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="1"  Margin="0,15,0,0" Padding="5">
                    <StackPanel Orientation="Vertical">
                        <Grid Width="180" Margin="0,5,0,0">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Row="0" Grid.Column="0" Content="{Resx Username}" Style="{StaticResource StandardTextLabel}" Height="25" />
                            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Username}" IsEnabled="{Binding NotLoggedIn}" Margin="0,0,0,2" Height="25" VerticalContentAlignment="Center" />
                            <Label Grid.Row="1" Grid.Column="0" Content="{Resx Password}" Style="{StaticResource StandardTextLabel}" Height="25" />
                            <PasswordBox Height="25" VerticalContentAlignment="Center" x:Name="PasswordBox" Grid.Row="1" Grid.Column="1" h:PasswordHelper.Attach="True" h:PasswordHelper.Password="{Binding Text, ElementName=plain, Mode=TwoWay}" IsEnabled="{Binding NotLoggedIn}">
                                <i:Interaction.Triggers>
                                    <t:PasswordtBoxEnterKeyTrigger>
                                        <t:ExecuteCommandAction Command="LogInCommand" />
                                    </t:PasswordtBoxEnterKeyTrigger>
                                </i:Interaction.Triggers>
                            </PasswordBox>
                            <TextBlock x:Name="plain" Visibility="Hidden" />
                        </Grid>
                        <Grid Margin="0,15,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Column="0" Content="{Resx ReissuePassword}" IsEnabled="{Binding NotLoggedIn}" />
                            <Button Grid.Column="1" Content="{Resx LogIn}" Command="{Binding LogInCommand}" CommandParameter="{Binding ElementName=PasswordBox}" IsEnabled="{Binding NotLoggedIn}" />
                        </Grid>
                    </StackPanel>
                </Border>
            </StackPanel>
        </Border>
    </Grid>

</UserControl>
